#include <vector>
#include <iostream>
#include <algorithm>
#include <set>

using namespace std;

void subpermutation(const vector<int> v, int n){
    sort(v.begin(), v.end());
    set<vector<int>> result;
    do
    {
        vector<int> line(v.begin(), v.begin() + n);
        result.insert(line);
    } while ( next_permutation( v.begin(), v.end() ) );
    for ( vector<int> i : result )
    {
        for ( int j : i )
        {
        cout << j << " ";
        }
        cout << endl;
    }
}

int main(int argc, char const *argv[])
{
    /* code */
    return 0;
}
